<template>
  <div>
    <input type="text" v-model.trim="showContent" />
    <button @click="addContent">添加事项</button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      showContent: ''
    }
  },
  methods: {
    addContent() {
      if (!this.showContent) return alert('文本框不能为空')
      this.$store.commit('receiveAddContent', this.showContent)
      this.showContent = ''
    }
  }
}
</script>

<style scoped></style>
